﻿<!--#INCLUDE FILE="config.asp"-->
<%
if(Session("AdminAccessLevel") <> 1 and Session("AdminAccessLevel") <> 3) then
	Response.Redirect("admin-login.asp?msg=invalid")
end if

'Endcrypt information of CC
Set objEncrypter = Server.CreateObject ("Hyeongryeol.StringEncrypter")
objEncrypter.Key = edCode
objEncrypter.InitialVector = conIV

encryptNombreCard = objEncrypter.Encrypt(Request("NombreCard"))
encryptTipo = objEncrypter.Encrypt(Request("Tipo"))
encryptNumerodeTarjetaCard = objEncrypter.Encrypt(Request("NumerodeTarjetaCard"))
encryptCodigodeSeguridad = objEncrypter.Encrypt(Request("CodigodeSeguridad"))

' Add record to Travels

	codeID = Request("codeId")
	habitacion = Request("Habitacion")
	numeroTotaldeInvitados = Request("NumeroTotaldeInvitados")
	numerodeNinos = Request("NumerodeNinos")
	NochesExtras = Request("NochesExtras")
	NombresdeAcompanantes = Request("NombresdeAcompanantes")
	detallesdeHabitacion = Request("DetallesdeHabitacion")
	actividades = Request("Actividades")
	arrival1 = Request("arrival1")
	departure1 = Request("departure1")
	arrival2 = Request("arrival2")
	departure2 = Request("departure2")
	
' Add record to Transport

	Legada_Aereolinea = Request("Aereolinea")
	Legada_Aereopuerto = Request("Aereopuerto")
	Legada_NecesitanTransporte = Request("NecesitanTransporte")
	HoraAproximadadellegada = Request("HoraAproximadadellegada")
	Salida_Aereolinea = Request("Salida_Aereolinea")
	Salida_Aereopuerto = Request("Salida_Aereopuerto")
	Salida_NecesitanTransporte = Request("Salida_NecesitanTransporte")
	HoradeSalida = Request("HoradeSalida")
	Notas = Request("Notas")
	InforamacionPendiente = Request("InforamacionPendiente")

' Them record vao Guests
	Title = Request("Title") 
	Nombre = Request("Nombre")
	Segundo_Nombre = Request("Segundo_Nombre")
	Apellido = Request("Apellido")
	Telefono = Request("Telefono")
	email = Request("email")
	Idioma = Request("Idioma")
	Direccion1 = Request("Direccion1")
	Direccion2 = Request("Direccion2")
	Ciudad = Request("Ciudad")
	Stado = Request("Stado")
	Postal = Request("Postal")
	Pais = Request("Pais")
	Comunicasion = Request("Comunicasion")
	
	' check value of Checkbox Confirm
	value = Request("checkClientSerious")
	
	if (value = "") then 
		valueOfCheckbox = 0
	else
		valueOfCheckbox = 1
	end if
	
	set objConnect = server.createObject("ADODB.Connection")       
		objConnect.open conStr
		
	Set oCmd = Server.CreateObject("ADODB.Command")
		  
		    oCmd.ActiveConnection = objConnect
			oCmd.CommandText = "sp_add_new_Guests" 
			oCmd.CommandType = 4
			
			' ****************
			' Guests Parameters
			' ****************
			Set Title = oCmd.CreateParameter("@title", 200,1,100,Title)
			oCmd.Parameters.Append Title
			
			Set Nombre = oCmd.CreateParameter("@name", 200,1,100,Nombre)
			oCmd.Parameters.Append Nombre
			
			Set Segundo_Nombre = oCmd.CreateParameter("@middle", 200,1,100,Segundo_Nombre)
			oCmd.Parameters.Append Segundo_Nombre
			
			Set Apellido = oCmd.CreateParameter("@surname", 200,1,100,Apellido)
			oCmd.Parameters.Append Apellido
			
			Set Telefono = oCmd.CreateParameter("@phone", 200,1,100,Telefono)
			oCmd.Parameters.Append Telefono
			
			Set email = oCmd.CreateParameter("@email", 200,1,100,email)
			oCmd.Parameters.Append email
			
			Set Idioma = oCmd.CreateParameter("@languageID", 3,1,100,Idioma)
			oCmd.Parameters.Append Idioma
			
			Set Direccion1 = oCmd.CreateParameter("@address1", 200,1,100,Direccion1)
			oCmd.Parameters.Append Direccion1
			
			Set Direccion2 = oCmd.CreateParameter("@address2", 200,1,100,Direccion2)
			oCmd.Parameters.Append Direccion2
			
			Set Ciudad = oCmd.CreateParameter("@city", 200,1,100,Ciudad)
			oCmd.Parameters.Append Ciudad
			
			Set Stado = oCmd.CreateParameter("@province", 200,1,100,Stado)
			oCmd.Parameters.Append Stado
			
			Set Postal = oCmd.CreateParameter("@zip", 200,1,100,Postal)
			oCmd.Parameters.Append Postal
			
			Set Pais = oCmd.CreateParameter("@country", 200,1,100,Pais)
			oCmd.Parameters.Append Pais
			
			Set Comunicasion = oCmd.CreateParameter("@communication", 200,1,100,Comunicasion)
			oCmd.Parameters.Append Comunicasion
			
			
			' *******************
			' Transport Parameter
			' *******************
			
			Set Legada_Aereolinea = oCmd.CreateParameter("@ArrivalAirlineID", 3,1,100,Legada_Aereolinea)
			oCmd.Parameters.Append Legada_Aereolinea
			
			Set Legada_Aereopuerto = oCmd.CreateParameter("@ArrivalAirportID", 3,1,100,Legada_Aereopuerto)
			oCmd.Parameters.Append Legada_Aereopuerto
			
			Set Legada_NecesitanTransporte = oCmd.CreateParameter("@ArrivalNeedTransport", 3,1,100,Legada_NecesitanTransporte)
			oCmd.Parameters.Append Legada_NecesitanTransporte
			
			Set HoraAproximadadellegada = oCmd.CreateParameter("@ApproximateArrivalTime", 200,1,100,HoraAproximadadellegada)
			oCmd.Parameters.Append HoraAproximadadellegada
			
			Set Salida_Aereolinea = oCmd.CreateParameter("@DepartureAirlineID", 3,1,100,Salida_Aereolinea)
			oCmd.Parameters.Append Salida_Aereolinea
			
			Set Salida_Aereopuerto = oCmd.CreateParameter("@DepartureAirportID", 3,1,100,Salida_Aereopuerto)
			oCmd.Parameters.Append Salida_Aereopuerto
			
			Set Salida_NecesitanTransporte = oCmd.CreateParameter("@DepartureNeedTransport", 3,1,100,Salida_NecesitanTransporte)
			oCmd.Parameters.Append Salida_NecesitanTransporte
			
			Set HoradeSalida = oCmd.CreateParameter("@DepartureTime", 200,1,100,HoradeSalida)
			oCmd.Parameters.Append HoradeSalida
			
			Set Notas = oCmd.CreateParameter("@Notes", 200,1,550,Notas)
			oCmd.Parameters.Append Notas
			
			Set InforamacionPendiente = oCmd.CreateParameter("@InformationPending", 200,1,100,InforamacionPendiente)
			oCmd.Parameters.Append InforamacionPendiente
			
			' ********************
			' Travels
			' **********************
			
			Set codeID = oCmd.CreateParameter("@codeID", 3,1,100,codeID)
			oCmd.Parameters.Append codeID
			
			Set habitacion = oCmd.CreateParameter("@roomSize", 200,1,100,habitacion)
			oCmd.Parameters.Append habitacion
			
			Set arrival1 = oCmd.CreateParameter("@arrivalDate1", 200,1,100,arrival1)
			oCmd.Parameters.Append arrival1
			
			Set departure1 = oCmd.CreateParameter("@departureDate1", 200,1,100,departure1)
			oCmd.Parameters.Append departure1
			
			Set arrival2 = oCmd.CreateParameter("@arrivalDate2", 200,1,100,arrival2)
			oCmd.Parameters.Append arrival2
			
			Set departure2 = oCmd.CreateParameter("@departureDate2", 200,1,100,departure2)
			oCmd.Parameters.Append departure2
			
			Set totalNumberGuests = oCmd.CreateParameter("@totalNumberGuests", 3,1,100,numeroTotaldeInvitados)
			oCmd.Parameters.Append totalNumberGuests
			
			Set nochesExtras = oCmd.CreateParameter("@extraNight", 3,1,100,NochesExtras)
			oCmd.Parameters.Append nochesExtras
			
			Set namesOfChaperones = oCmd.CreateParameter("@namesOfChaperones", 200,1,100,NombresdeAcompanantes)
			oCmd.Parameters.Append namesOfChaperones
			
			Set roomDetail = oCmd.CreateParameter("@roomDetail", 200,1,100,detallesdeHabitacion)
			oCmd.Parameters.Append roomDetail
			
			Set actividades = oCmd.CreateParameter("@activitiesOnTravel", 200,1,100,actividades)
			oCmd.Parameters.Append actividades
			
			Set numberChildren = oCmd.CreateParameter("@numberChildren", 3,1,100,numerodeNinos)
			oCmd.Parameters.Append numberChildren
			
			' ********************
			' Extra Noches 1
			' **********************
			
			Set habitacion_divA = oCmd.CreateParameter("@roomSize_divA", 200,1,100,Request("Habitacion_divA"))
			oCmd.Parameters.Append habitacion_divA
			
			Set arrival1_divA = oCmd.CreateParameter("@arrivalDate1_divA", 200,1,100,Request("arrival1_divA"))
			oCmd.Parameters.Append arrival1_divA
			
			Set departure1_divA = oCmd.CreateParameter("@departureDate1_divA", 200,1,100,Request("departure1_divA"))
			oCmd.Parameters.Append departure1_divA
			
			Set arrival2_divA = oCmd.CreateParameter("@arrivalDate2_divA", 200,1,100,Request("arrival2_divA"))
			oCmd.Parameters.Append arrival2_divA
			
			Set departure2_divA = oCmd.CreateParameter("@departureDate2_divA", 200,1,100,Request("departure2_divA"))
			oCmd.Parameters.Append departure2_divA
			
			Set totalNumberGuests_divA = oCmd.CreateParameter("@totalNumberGuests_divA", 3,1,100,Request("NumeroTotaldeInvitados_divA"))
			oCmd.Parameters.Append totalNumberGuests_divA

			Set namesOfChaperones_divA = oCmd.CreateParameter("@namesOfChaperones_divA", 200,1,100,Request("NombresdeAcompanantes_divA"))
			oCmd.Parameters.Append namesOfChaperones_divA
			
			Set roomDetail_divA = oCmd.CreateParameter("@roomDetail_divA", 200,1,100,Request("DetallesdeHabitacion_divA"))
			oCmd.Parameters.Append roomDetail_divA
			
			Set actividades_divA = oCmd.CreateParameter("@activitiesOnTravel_divA", 200,1,100,Request("Actividades_divA"))
			oCmd.Parameters.Append actividades_divA
			
			Set numberChildren_divA = oCmd.CreateParameter("@numberChildren_divA", 3,1,100,Request("NumerodeNinos_divA"))
			oCmd.Parameters.Append numberChildren_divA

			
			' ********************
			' Extra Noches 2
			' **********************
			
			Set habitacion_divB = oCmd.CreateParameter("@roomSize_divB", 200,1,100,Request("Habitacion_divB"))
			oCmd.Parameters.Append habitacion_divB
			
			Set arrival1_divB = oCmd.CreateParameter("@arrivalDate1_divB", 200,1,100,Request("arrival1_divB"))
			oCmd.Parameters.Append arrival1_divB
			
			Set departure1_divB = oCmd.CreateParameter("@departureDate1_divB", 200,1,100,Request("departure1_divB"))
			oCmd.Parameters.Append departure1_divB
			
			Set arrival2_divB = oCmd.CreateParameter("@arrivalDate2_divB", 200,1,100,Request("arrival2_divB"))
			oCmd.Parameters.Append arrival2_divB
			
			Set departure2_divB = oCmd.CreateParameter("@departureDate2_divB", 200,1,100,Request("departure2_divB"))
			oCmd.Parameters.Append departure2_divB
			
			Set totalNumberGuests_divB = oCmd.CreateParameter("@totalNumberGuests_divB", 3,1,100,Request("NumeroTotaldeInvitados_divB"))
			oCmd.Parameters.Append totalNumberGuests_divB

			Set namesOfChaperones_divB = oCmd.CreateParameter("@namesOfChaperones_divB", 200,1,100,Request("NombresdeAcompanantes_divB"))
			oCmd.Parameters.Append namesOfChaperones_divB
			
			Set roomDetail_divB = oCmd.CreateParameter("@roomDetail_divB", 200,1,100,Request("DetallesdeHabitacion_divB"))
			oCmd.Parameters.Append roomDetail_divB
			
			Set actividades_divB = oCmd.CreateParameter("@activitiesOnTravel_divB", 200,1,100,Request("Actividades_divB"))
			oCmd.Parameters.Append actividades_divB
			
			Set numberChildren_divB = oCmd.CreateParameter("@numberChildren_divB", 3,1,100,Request("NumerodeNinos_divB"))
			oCmd.Parameters.Append numberChildren_divB
			
			
			' ********************
			' END Extra Noches 2
			' **********************
			
			' ********************
			' Extra Noches 3
			' **********************
			
			Set habitacion_divC = oCmd.CreateParameter("@roomSize_divC", 200,1,100,Request("Habitacion_divC"))
			oCmd.Parameters.Append habitacion_divC
			
			Set arrival1_divC = oCmd.CreateParameter("@arrivalDate1_divC", 200,1,100,Request("arrival1_divC"))
			oCmd.Parameters.Append arrival1_divC
			
			Set departure1_divC = oCmd.CreateParameter("@departureDate1_divC", 200,1,100,Request("departure1_divC"))
			oCmd.Parameters.Append departure1_divC
			
			Set arrival2_divC = oCmd.CreateParameter("@arrivalDate2_divC", 200,1,100,Request("arrival2_divC"))
			oCmd.Parameters.Append arrival2_divC
			
			Set departure2_divC = oCmd.CreateParameter("@departureDate2_divC", 200,1,100,Request("departure2_divC"))
			oCmd.Parameters.Append departure2_divC
			
			Set totalNumberGuests_divC = oCmd.CreateParameter("@totalNumberGuests_divC", 3,1,100,Request("NumeroTotaldeInvitados_divC"))
			oCmd.Parameters.Append totalNumberGuests_divC
			
			Set namesOfChaperones_divC = oCmd.CreateParameter("@namesOfChaperones_divC", 200,1,100,Request("NombresdeAcompanantes_divC"))
			oCmd.Parameters.Append namesOfChaperones_divC
			
			Set roomDetail_divC = oCmd.CreateParameter("@roomDetail_divC", 200,1,100,Request("DetallesdeHabitacion_divC"))
			oCmd.Parameters.Append roomDetail_divC
			
			Set actividades_divC = oCmd.CreateParameter("@activitiesOnTravel_divC", 200,1,100,Request("Actividades_divC"))
			oCmd.Parameters.Append actividades_divC
			
			Set numberChildren_divC = oCmd.CreateParameter("@numberChildren_divC", 3,1,100,Request("NumerodeNinos_divC"))
			oCmd.Parameters.Append numberChildren_divC

			
			' ********************
			' END Extra Noches 3
			' **********************
			
			' ********************
			' CreditCards
			' **********************
			Set NombreCard = oCmd.CreateParameter("@NombreCard", 200,1,100,encryptNombreCard)
			oCmd.Parameters.Append NombreCard
			
			Set Tipo = oCmd.CreateParameter("@Tipo", 200,1,100,encryptTipo)
			oCmd.Parameters.Append Tipo
			
			Set NumerodeTarjetaCard = oCmd.CreateParameter("@NumerodeTarjetaCard", 200,1,100,encryptNumerodeTarjetaCard)
			oCmd.Parameters.Append NumerodeTarjetaCard
			
			Set Address1_billing = oCmd.CreateParameter("@Address1_billing", 200,1,100,Request("Direccion1_billing"))
			oCmd.Parameters.Append Address1_billing
			
			Set Address2_billing = oCmd.CreateParameter("@Address2_billing", 200,1,100,Request("Direccion2_billing"))
			oCmd.Parameters.Append Address2_billing
			
			Set City_billing = oCmd.CreateParameter("@City_billing", 200,1,100,Request("Ciudad_billing"))
			oCmd.Parameters.Append City_billing
			
			Set Country_billing = oCmd.CreateParameter("@Country_billing", 200,1,100,Request("Pais_billing"))
			oCmd.Parameters.Append Country_billing
			
			Set ZipCode_billing = oCmd.CreateParameter("@ZipCode_billing", 200,1,100,Request("Postal_billing"))
			oCmd.Parameters.Append ZipCode_billing
			
			Set Province_billing = oCmd.CreateParameter("@Province_billing", 200,1,100,Request("Stado_billing"))
			oCmd.Parameters.Append Province_billing
			
			Set FechaDeExpiracion = oCmd.CreateParameter("@FechaDeExpiracion", 200,1,100,Request("FechaDeExpiracion"))
			oCmd.Parameters.Append FechaDeExpiracion
			
			Set CodigodeSeguridad = oCmd.CreateParameter("@CodigodeSeguridad", 200,1,100,encryptCodigodeSeguridad)
			oCmd.Parameters.Append CodigodeSeguridad
			
			Set userId = oCmd.CreateParameter("@userId", 3,1,100,session("AdminId"))
			oCmd.Parameters.Append userId
			
			' ********************
			' End CreditCards
			' **********************
			
			Set area_divA = oCmd.CreateParameter("@area_divA", 3,1,100,Request("checked_divA"))
			oCmd.Parameters.Append area_divA
			
			Set area_divB = oCmd.CreateParameter("@area_divB", 3,1,100,Request("checked_divB"))
			oCmd.Parameters.Append area_divB
			
			Set area_divC = oCmd.CreateParameter("@area_divC", 3,1,100,Request("checked_divC"))
			oCmd.Parameters.Append area_divC
			
			Set valueofcheckbox = oCmd.CreateParameter("@valueOfCheckbox", 3,1,100,valueOfCheckbox)
			oCmd.Parameters.Append valueofcheckbox
			
		set rss = oCmd.execute
	
	Response.Redirect("admin-dashboard.asp")

%>